Free blkif if vbd_create fails.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 13 Sep 2005 19:43:58 +0000 (19:43 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 13 Sep 2005 19:43:58 +0000 (19:43 +0000)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c

index bf9817a8f087e1a63e63094578330b158828c2f4..c081aa8240ce0b5f75831a9038804c169963f6f2 100644 (file)
@@ -170,7 +170,6 @@ static void backend_changed(struct xenbus_watch *watch, const char *node)
 
                be->blkif = alloc_blkif(be->frontend_id);
                if (IS_ERR(be->blkif)) {
-                        /* XXX SMH: should free blkif here... hmm */
                        err = PTR_ERR(be->blkif);
                        be->blkif = NULL;
                        xenbus_dev_error(dev, err, "creating block interface");
@@ -179,8 +178,8 @@ static void backend_changed(struct xenbus_watch *watch, const char *node)
 
                err = vbd_create(be->blkif, handle, be->pdev, be->readonly);
                if (err) {
-                        /* XXX SMH: should free blkif here too... */
-                        be->blkif = NULL; 
+                       blkif_put(be->blkif);
+                       be->blkif = NULL;
                        xenbus_dev_error(dev, err, "creating vbd structure");
                        return;
                }